package com.ruoyi.map.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.map.domain.MapStation;
import com.ruoyi.map.service.MapStationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: my-ruoyi-master_202130504106_李航
 * @description:
 * @author: LiHang
 * @create: 2021-10-30 16:30
 **/
@Api("地区与设备信息获取类")
@Slf4j
@RestController
public class MapWithStationController {

    @Autowired
    MapStationService mapStationService;

    @ApiOperation(value = "查询所有二级站相关信息", notes = "")
    @GetMapping("/getAllMapStation")
    public AjaxResult allRegionTree() {
        return AjaxResult.success(mapStationService.selectAllStation());
    }

    /**
     * 根据地区查询二级站相关信息
     * @param mapStation
     * @return
     */
    @ApiOperation(value = "根据地区查询二级站相关信息", notes = "示例:http://192.168.1.217:8180/selectStationbyProvince\n请求头附带省份区域信息")
    //@ResponseBody
    @PostMapping("/selectStationbyProvince")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value="对应的数据id",paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "province",value="省份",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "city",value="市",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "district",value="区",paramType = "query",dataType = "String"),
    })
    public AjaxResult selectPlotbyProvince(MapStation mapStation){
        List<MapStation> mapStations = mapStationService.selectPlotbyProvince(mapStation);

        return AjaxResult.success(mapStations);
    }
}
